using System;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;

namespace WeChat.Controls;

public sealed class ChatMessage : ContentControl
{
    private const string RightButtonPressed = ":rightButtonPressed";

    /// <summary>
    /// 消息显示在左边还是右边
    /// </summary>
    public static readonly StyledProperty<bool> IsRightProperty = AvaloniaProperty
        .Register<ChatMessage,
            bool>(
            nameof(IsRight));

    /// <summary>
    /// 消息显示在左边还是右边
    /// </summary>
    public bool IsRight
    {
        get => GetValue(IsRightProperty);
        set => SetValue(IsRightProperty, value);
    }

    /// <summary>
    /// 消息最大的长度
    /// </summary>
    public static readonly StyledProperty<double> MsgMaxWidthProperty = AvaloniaProperty
        .Register<ChatMessage,
            double>(
            nameof(MsgMaxWidth));

    /// <summary>
    /// 消息最大的长度
    /// </summary>
    public double MsgMaxWidth
    {
        get => GetValue(MsgMaxWidthProperty);
        set => SetValue(MsgMaxWidthProperty, value);
    }

    /// <summary>
    /// 名字
    /// </summary>
    public static readonly StyledProperty<string> UsernameProperty = AvaloniaProperty
        .Register<ChatMessage,
            string>(
            nameof(Username));

    /// <summary>
    /// 名字
    /// </summary>
    public string Username
    {
        get => GetValue(UsernameProperty);
        set => SetValue(UsernameProperty, value);
    }

    /// <summary>
    /// 头像
    /// </summary>
    public static readonly StyledProperty<IImage> PhotoProperty = AvaloniaProperty
        .Register<ChatMessage,
            IImage>(
            nameof(IsRight));

    /// <summary>
    /// 头像
    /// </summary>
    public IImage Photo
    {
        get => GetValue(PhotoProperty);
        set => SetValue(PhotoProperty, value);
    }
}